<template>
  <div class="calendarDetailItem-wrapper">
    <div class="title">
      <div>{{objData.title || '今日诊疗收款(元)'}}</div>
      <div>
        <span>{{Number(objData.todayNum).toFixed(2) || '0.00'}}</span>
        <span v-if="objData.todayNum < objData.yesterdayNum" class="icon-arrow">
        <el-icon><bottom /></el-icon></span>
        <span v-else class="icon-arrow">
          <el-icon><top /></el-icon>
        </span>
      </div>
      <div>昨日:{{Number(objData.yesterdayNum).toFixed(2) || '26,013.90'}}</div>
    </div>
    <div class="content">
      <div class="content-item" v-for="item in objData.list">
          <abbr v-if="item.isShow" :title="item.content" style="text-decoration: none">
            <span >{{item.title}}</span>
          </abbr>
          
          <span v-if="!item.isShow">{{item.title}}</span>
        <span>{{Number(item.num).toFixed(2)}}</span>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Bottom, Top } from '@element-plus/icons-vue'
import { defineComponent, PropType } from 'vue';

type ListType = {
  title: string,
  num: number,
  isShow: false,
  content: string,
}
type ObjDataType = {
  title: string,
  todayNum: number,
  yesterdayNum: number,
  list: any[]
}
export default defineComponent({
  name: 'CalendarDetailItem',
  components: {
    Bottom,
    Top
  },
  props: {
    objData: {
      type: Object as PropType<ObjDataType>,
      default: {}
    }
  }
})
</script>

<style lang="scss" scoped>
.calendarDetailItem-wrapper {
  background-color: #f5f6f7;
  display: flex;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  height: 100%;

  .title {
    height: 80px;
    width: 78%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 10px 0;
    border-bottom: 1px solid #d9d9d9;
    font-size: 14px;

    & > div:nth-child(2) {
      font-size: 32px;
      .icon-arrow {
        color: red;
        display: inline-block;
        transform: scale(.65);
      }
    }
    & > div:nth-child(3) {
      transform: scale(.9);
    }
  }

  .content {
    flex: 1;
    display: flex;
    font-size: 14px;
    flex-direction: column;

    .content-item {
      height: 30px;
      line-height: 30px;
      width: 78%;
      margin: 0 auto;
      display: flex;
      & > span {
        display: inline-block;
      }
      & > span:nth-child(1) {
        width: 260px;
      }
      & > span:nth-child(2) {
        flex: 1;
        text-align: right;
      }
    }

    .content-item:nth-child(even) {
      background-color: #fff;
    }
  }
}
</style>